import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)
// 获取原型对象push函数
const originalPush = VueRouter.prototype.push

// 获取原型对象replace函数
const originalReplace = VueRouter.prototype.replace

// 修改原型对象中的push函数
VueRouter.prototype.push = function push(location){
return originalPush.call(this , location).catch(err=>err)
}

// 修改原型对象中的replace函数
VueRouter.prototype.replace = function replace(location){
return originalReplace.call(this , location).catch(err=>err)
}
const routes = [
  {
    path: "/",
    name: "Home",
    component: () => import("@/pages/home/home.vue"),
    meta: {
      title: "主页",
    },
  },
  {
    path: "/emergency",
    name: 'Emergency',
    component: () => import("@/pages/emergency/index.vue"),
    meta: {
      title: '安防应急',
    },
    /* children: [
      {
        path: "protection",
        name: "Protection",
        component: () => import("@/pages/emergency/protection.vue"),
        meta: {
          title: '实体防护',
        },
      },
      {
        path: "accessControl",
        name: "AccessControl",
        component: () => import("@/pages/emergency/accessControl.vue"),
        meta: {
          title: '出入口控制',
        },
      },
      {
        path: "supervisory",
        name: "Supervisory",
        component: () => import("@/pages/emergency/supervisory.vue"),
        meta: {
          title: '视频监控',
        },
      },
      {
        path: "securityCheck",
        name: "SecurityCheck",
        component: () => import("@/pages/emergency/securityCheck.vue"),
        meta: {
          title: '违禁品安检',
        },
      },
      {
        path: "intrusionDetection",
        name: "IntrusionDetection",
        component: () => import("@/pages/emergency/intrusionDetection.vue"),
        meta: {
          title: '入侵检测',
        },
      },
    ] */
  },
  {
    path: "/livelihood",
    name: 'Livelihood',
    // component: () => import("@/pages/livelihood/index.vue"),
    component: () => import("@/pages/livelihood/livelihoodIndex.vue"),
    meta: {
      title: '人口民生',
    },
    /* children: [
      {
        path: "livelihoodIndex",
        name: "LivelihoodIndex",
        component: () => import("@/pages/livelihood/livelihoodIndex.vue"),
        meta: {
          title: '民生指数',
        },
      },
      {
        path: "populationArea",
        name: "PopulationArea",
        component: () => import("@/pages/livelihood/populationArea.vue"),
        meta: {
          title: '人口区域',
        },
      },
      {
        path: "municipal",
        name: "Municipal",
        component: () => import("@/pages/livelihood/municipal.vue"),
        meta: {
          title: '市政一体化',
        },
      },
    ] */
  },
  {
    path: "/waterConservancyEnergy",
    name: 'WaterConservancyEnergy',
    component: () => import("@/pages/waterConservancyEnergy/waterMonitor.vue"),
    // redirect: "/waterConservancyEnergy/energySupply",
    meta: {
      title: '水利能源',
    },
    children: [
      {
        path: "waterMonitor",
        name: "WaterMonitor",
        component: () => import("@/pages/waterConservancyEnergy/waterMonitor.vue"),
        meta: {
          title: '水利监测',
        },
      },
      {
        path: "energySupply",
        name: "EnergySupply",
        component: () => import("@/pages/waterConservancyEnergy/energySupply.vue"),
        meta: {
          title: '能源供给',
        },
      },
      {
        path: "energyConsumption",
        name: "EnergyConsumption",
        component: () => import("@/pages/waterConservancyEnergy/energyConsumption.vue"),
        meta: {
          title: '电力消耗',
        },
      },
    ]
  },
  {
    path: "/cityOverview",
    name: 'CityOverview',
    component: () => import("@/pages/cityOverview/index.vue"),
    meta: {
      title: '城市总览',
    },
    /* children: [
      {
        path: "urbanService",
        name: "UrbanService",
        component: () => import("@/pages/cityOverview/urbanService.vue"),
        meta: {
          title: '城区服务',
        },
      },
      {
        path: "hydrogeography",
        name: "Hydrogeography",
        component: () => import("@/pages/cityOverview/hydrogeography.vue"),
        meta: {
          title: '水文地理',
        },
      },
      {
        path: "planning",
        name: "Planning",
        component: () => import("@/pages/cityOverview/planning.vue"),
        meta: {
          title: '行政规划',
        },
      },
    ] */
  },
  {
    path: "/intelligentTraffic",
    name: 'IntelligentTraffic',
    // component: () => import("@/pages/intelligentTraffic/pullUp.vue"),
    component: () => import("@/pages/intelligentTraffic/publicTransport.vue"),
    meta: {
      title: '智慧交通',
    },
    children: [
      {
        path: "pullUp",
        name: "PullUp",
        component: () => import("@/pages/intelligentTraffic/pullUp.vue"),
        meta: {
          title: '停车',
        },
      },
      {
        path: "roadNetwork",
        name: "RoadNetwork",
        component: () => import("@/pages/intelligentTraffic/roadNetwork.vue"),
        meta: {
          title: '路网',
        },
      },
      {
        path: "publicTransport",
        name: "PublicTransport",
        component: () => import("@/pages/intelligentTraffic/publicTransport.vue"),
        meta: {
          title: '公共交通',
        },
      },
      {
        path: "peopleTraffic",
        name: "PeopleTraffic",
        component: () => import("@/pages/intelligentTraffic/peopleTraffic.vue"),
        meta: {
          title: '人行',
        },
      },
    ]
  },
  {
    path: "/commercialEconomy",
    name: 'CommercialEconomy',
    component: () => import("@/pages/commercialEconomy/index.vue"),
    meta: {
      title: '商业经济',
    },
    /* children: [
      {
        path: "tourismService",
        name: "TourismService",
        component: () => import("@/pages/commercialEconomy/tourismService.vue"),
        meta: {
          title: '旅游服务',
        },
      },
      {
        path: "passengerAnalysis",
        name: "PassengerAnalysis",
        component: () => import("@/pages/commercialEconomy/passengerAnalysis.vue"),
        meta: {
          title: '客流分析',
        },
      },
      {
        path: "guideTerminal",
        name: "GuideTerminal",
        component: () => import("@/pages/commercialEconomy/guideTerminal.vue"),
        meta: {
          title: '导购终端',
        },
      },
    ] */
  },
  {
    path: "/unreal",
    name: 'Unreal',
    component: () => import("@/views/PlayerView.vue"),
    meta: {
      title: '云流化',
    },
  }
]

const router = new VueRouter({
  routes
})

export default router
